import { createRouter, createWebHistory } from 'vue-router'
//layout目录下的路由
export const rootRouter = [
  {
    path: '/',
    name: 'layout',
    component: () => import('../layout/MainLayout.vue'),
    children: [
      {
        path: '/',
        name: 'home',
        meta: { title: '首页' },
        component: () => import('../views/HomeView.vue'),
      },
      {
        path: '/about',
        name: 'about',
        meta: { title: '关于' },
        component: () => import('../views/AboutView.vue'),
      },
      {
        path: '/choice',
        name: 'choice',
        meta: { title: '选择题' },
        component: () => import('../views/topic/ChoiceTopic.vue'),
      },
    ],
  },
]
const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    ...rootRouter,
    {
      path: '/login',
      name: 'login',
      component: () => import('../views/LoginView.vue'),
    },
  ],
})

export default router
